package numberslider;

import java.sql.SQLException;
import java.sql.ResultSet;

/**
 * Created by IntelliJ IDEA.
 * User: Admin
 * Date: Dec 23, 2009
 * Time: 12:36:28 AM
 * To change this template use File | Settings | File Templates.
 */
public class ScrollingResultSetTableModel extends ResultSetTableModel
{  public ScrollingResultSetTableModel(ResultSet aResultSet)
   {  super(aResultSet);
   }

   public Object getValueAt(int r, int c)
   {  try
      {  ResultSet rs = getResultSet();
         rs.absolute(r + 1);
         return rs.getObject(c + 1);
      }
      catch(SQLException e)
      {  System.out.println("Error " + e);
         return null;
      }
   }

   public int getRowCount()
   {  try
      {  ResultSet rs = getResultSet();
         rs.last();
         return rs.getRow();
      }
      catch(SQLException e)
      {  System.out.println("Error " + e);
         return 0;
      }
   }
}

